<?php 
require_once('Admin/Common/template/inc_admin.php');
?>  
<div id="content">
	<div class="inner" style="min-height:1200px;">

		<div align=center>
			<h1 style="text-align:center">
				新闻列表</h1>	
				<button class="btn btn-default" style="font-family: 微软雅黑; position: relative;left: 10% ;width:80px;height:40px"><a href="admin.php?c=news&m=newsform">添加新闻</a></button>
				<div class="container-fluid control-label  col-md-12 ">

					<form method=post action="admin.php?c=news&m=search" enctype="multipart/form-data" class="form-horizontal">
						<div class="form-group">
							<label for="newsname" class="control-label col-md-8 col-md-offset-1">请输入新闻名:</label>
							<div class="col-md-2 " >
								<input type="text" name="key" class="form-control" id="newsname">
							</div>
							<input type="submit" class="btn btn-success" value="搜索">
						</div>
					</form>
					<table class="table table-hover">
						<tr class="info">
							<th>序号</th>
							<th>新闻类别</th>
							<th>新闻标题</th>
							<th>图片</th>
							<th>上传时间</th>
							<th>新闻内容</th>
							<th>热点</th>
							<th>操作</th>
						</tr>
						<?php
						foreach ($data['news'] as $row) {
							echo '<tr>';
							echo '<td>'.$row['nid'].'</td>';
							if ($row['ntid']=='1'){
								$newstype = "政治新闻";
							}else if($row['ntid']=='2'){
								$newstype = "社会新闻";
							}else if($row['ntid']=='3'){
								$newstype = "财经新闻";
							}else if($row['ntid']=='4'){
								$newstype = "军事新闻";
							}else if($row['ntid']=='5'){
								$newstype = "体育新闻";
							}else if($row['ntid']=='6'){
								$newstype = "娱乐新闻";
}
							echo '<td>'.$newstype.'</td>';
							echo '<td>'.$row['newsname'].'</td>';
							echo '<td align="center"><img src="./upload/'.$row['pic'].'" width=60 height=80 alt="无头像"></td>';
							echo '<td>'.$row['publishtime'].'</td>';
							echo '<td>'.$row['content'].'</td>';
							echo '<td>'.$row['latest'].'</td>';	 	 
							;	 
							echo '<td><button class="btn btn-info" style="font-family: 微软雅黑; position: relative;width:50px;height:40px"><a style="color:black;" href="admin.php?c=news&m=editnews&id='.$row['nid'].' ">修改</a></button>
							<button class="btn btn-danger" style="font-family: 微软雅黑; position:relative;;width:50px;height:40px"><a style="color:black;" href="admin.php?c=news&m=del&id='.$row['nid'].'" onClick="return confirm(\'确定要删除吗？\');">删除</a></button></td>';
							echo '</tr>';  
						}

						echo '</table>';  
						$totalrows = count($data['news']);
						echo '<h3 style="font-family:微软雅黑;text-align:right;color:purple;position:relative;right:50px">共有'.$totalrows.'条新闻</h3>'; 
						?>
					</div>
					<nav class="navbar navbar-fixed-bottom">
						<a href="#" "><img align="right"  src="./assets/images/gotop.jpg" alt="回顶部" width="50" height="50"></a>
					</nav>
				</body>
			</div>
		</div>      
	</div>  
	</html>